package com.jic.market.mapper;

import java.lang.Long;
import java.util.List;

import com.jic.market.entity.PromotionMutex;
import com.jic.market.response.CouponConfigQueryResponse;
import com.jic.market.response.PromotionMutexDetailResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 促销商品互斥表
 * @author : 
 * @email : 
 * @since : 2020-05-09 02:47:45
 * @version : v1.0.0
 */
@Mapper
@Repository
public interface  PromotionMutexMapper {

    long insert(PromotionMutex promotionMutex);

    long delete(Long id);

    long update(PromotionMutex promotionMutex);

    PromotionMutex queryByPrimaryKey(Long id);

    List<PromotionMutex> query(PromotionMutex promotionMutex);

    List<PromotionMutex> queryPage(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("promotionMutex") PromotionMutex promotionMutex);

    long queryPageCount(PromotionMutex promotionMutex);

    void deleteMutexByPromotionIdAndMerchantProductIds(@Param("promotionId") Long promotionId,@Param("ids") String ids , @Param("promType") Integer promType);

    PromotionMutex getMutexByParam(@Param("promotionMutex") PromotionMutex promotionMutex);

    List<PromotionMutexDetailResponse> queryByIdPromotionProduct(@Param("startIndex") int startIndex, @Param("limit") int limit,@Param("id")Long id);

    long queryByIdPromotionProductCount(@Param("startIndex") int startIndex, @Param("limit") int limit,@Param("id")Long id);

    List<PromotionMutexDetailResponse> queryByIdGrouponProduct(@Param("startIndex") int startIndex, @Param("limit") int limit,@Param("id")Long id);

    long queryByIdGrouponProductCount(@Param("startIndex") int startIndex, @Param("limit") int limit,@Param("id")Long id);

    void deleteListByPromotionIdAndPromType(PromotionMutex promotionMutex);

    int deleteByPromotionProductId(@Param("promotionProductId")Long promotionProductId);


    List<PromotionMutexDetailResponse> queryAllByProductId(@Param("startIndex") int startIndex, @Param("limit") int limit,@Param("id")Long id);

    long queryAllByProductIdCount(@Param("startIndex") int startIndex, @Param("limit") int limit,@Param("id")Long id);

    List<CouponConfigQueryResponse> queryRedMutexList(@Param("promType") String promType,@Param("promotionMerchantProductId") Long promotionMerchantProductId,
                                                      @Param("start") Integer start , @Param("limit") Integer limit, @Param("promotionCode") String promotionCode,
                                                      @Param("promName") String promName);

    Integer queryRedMutexCount(@Param("promType") String promType,@Param("promotionMerchantProductId") Long promotionMerchantProductId, @Param("promotionCode") String promotionCode,
                               @Param("promName") String promName);

    void deleteByPromotionProductIdAndPromType(@Param("promotionMerchantProductId") Long promotionMerchantProductId,@Param("promType") Integer promType);

    int deleteByPromotionIdAndPromType(@Param("promotionId") Long promotionId,@Param("promType") Integer promType);

    int insertBatch(@Param("items") List<PromotionMutex> items);
}